pp108 : oncontextregister Event

oncontextregister Event


This event is fired when a context menu is registered with a tree item.

Syntax

Inline HTML

<div cordysType="wcp.libaray.ui.Tree"  id=treeID treeData=treeDataID treeSchema=treeSchemaID oncontextregister="handler()" >
...
</div>

Event Property

treeID.oncontextregister = handler


Event Information

To invoke

Define thecontextmenuproperty for the tree items present in the tree schema.

Default Action

Initiates any action associated with this event.


Event Object Properties


Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query an event object for data.

Property

Description

treeItem

Read-only. Object that denotes the tree item for the specified node.


Example


The following example shows how the event is used to display the data of the node.

<!-- Schema defined outside the BODY tag of the HTML -->
<script type="cordys/xml"id="schema">
  <TreeSchema>
    <searchPath>//menu/</searchPath>
    <Root>
      <description>Northwind</description>
    </Root>
    <TreeItem id="applicationID">
      <searchPath>application</searchPath>
      <description>@class</description>
      <contextmenu>myContext</contextmenu>
    </TreeItem>
    <TreeItem id="dataID">
      <searchPath>data</searchPath>
      <description>name</description>
    </TreeItem>
  </TreeSchema>
</script>
//Function handler
function registerCall()
{
    application.notify("Data : " + event.treeItem.data);
}
<!-- tree definition inside the BODY tag -->
<div cordysType="wcp.libaray.ui.Tree"  id="sampleTree" treeSchema="sampleSchema" treeData="sampleData" oncontextregister="registerCall()"></div>

See Also


tree